using System;
using NUnit.Framework;

namespace ScenarioFramework.WorkflowEngine.Scheduler.TEST
{
	[TestFixture]
	public class TestScheduler
	{
        JobManager jobMan = null;

        public TestScheduler()
		{
		}

		[TestFixtureSetUp]
		public void init()
		{
            jobMan = new JobManager();
            WAPI.Response wapiResponse = new WAPI.Response();
            WAPI.Session.InitSession(ref wapiResponse);
            if (wapiResponse.iCode != 0)
                System.Console.Error.WriteLine("Impossible to initialize a scenario session");
    	}

		
		[TestFixtureTearDown]
		public void End()
		{
            System.Threading.Thread.Sleep(1000000000);
            jobMan.Stop();
		}

        [Test]
        public void StartListener()
        {
            jobMan.StartListener();
            
        }

        [Test]
        public void AddDummyJob()
        {
            jobMan.AddJob("ActivityJobExample",
                          typeof(ScenarioFramework.WorkflowEngine.Scheduler.Jobs.DummyJob),
                          "ActivityJob_everySecond",
                          Quartz.TriggerUtils.MakeSecondlyTrigger(),
                          DateTime.Now);
        }
	}
}
